package com.example.ViewPagerSum.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.ViewPagerSum.R;
import com.example.ViewPagerSum.domain.ResultTask;
import com.example.ViewPagerSum.interfaces.FinishedCallBack;
import com.example.ViewPagerSum.task.PortraitTask;
import com.example.ViewPagerSum.util.Constants;
import org.json.JSONObject;

/**
 * Created by wangjing on 2015/9/9at0:25.
 * <p/>
 * Email:wjontheway@163.com
 * <p/>
 * ViewPagerSum   写真
 */
public class SubPortraitMmFragment extends Fragment implements FinishedCallBack {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = null;
        view = inflater.inflate(R.layout.fragment_portrait_mm, container, false);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        PortraitTask task = new PortraitTask(this);
        task.execute();
    }


    /**
     * 接口回调
     *
     * @param resultTask
     */
    @Override
    public void onFinishedCallBack(ResultTask resultTask) {

        if (resultTask != null) {
            if (resultTask.action== Constants.ACTION_PORTRAIT_TASK){
                setupPortrait((JSONObject)resultTask.data);

            }
        }
    }


    /**
     * 在此处解析JSON数据
     * @param data
     */
    private void setupPortrait(JSONObject data) {


    }
}
